
package jp.moisture.othello.player;

import java.util.List;
import java.util.Random;

import jp.moisture.othello.board.Cell;
import jp.moisture.othello.board.Game.NextListener;

public class RandomPlayer extends Player {
    private static final Random RANDOM = new Random();

    public RandomPlayer(String name) {
        super(name);
    }

    public Cell next() {
        List<Cell> cells = mBoard.findPutableCells(mColor);
        if (cells.isEmpty()) {
            return null;
        }
        return cells.get(RANDOM.nextInt(cells.size()));
    }

}
